import { useState } from 'react'

/**
 *const update = useUpdate()
 *<button onClick={update}>update</button>
 * @return {*} 组件间更新
 */
const useUpdate = () => {
  const [, setFlag] = useState()
  const update = () => {
    setFlag(Date.now())
  }

  return update
}

export default useUpdate
